package cn.tannn.ops.quartz.service.impl;

import cn.tannn.jdevelops.jpa.service.J2ServiceImpl;
import cn.tannn.ops.quartz.dao.QrtzClazzMetaDao;
import cn.tannn.ops.quartz.entity.QrtzClazzMetaEntity;
import cn.tannn.ops.quartz.service.QrtzClazzMetaService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 任务工作类
 *
 * @author <a href="https://t.tannn.cn/">tan</a>
 * @version V1.0
 * @date 2024/8/26 上午11:48
 */
@Service
@Slf4j
public class QrtzClazzMetaServiceImpl extends J2ServiceImpl<QrtzClazzMetaDao, QrtzClazzMetaEntity, Integer> implements QrtzClazzMetaService {
    public QrtzClazzMetaServiceImpl() {
        super(QrtzClazzMetaEntity.class);
    }

    @Override
    public void registerClazzMeta(QrtzClazzMetaEntity clazzMetaEntity) {
        // 判断是否已经注册过
        if (getJpaBasicsDao().findByClazz(clazzMetaEntity.getClazz()).isEmpty()) {
            getJpaBasicsDao().save(clazzMetaEntity);
        }else {
            log.warn(" clazzMeta multiple registration");
        }
    }
}
